package eteam.aps.common.helper;

import eteam.aps.common.exceptions.BusinessException;

/**
 * @author Ll
 * @since 2024/1/9
 */
public class Assert {

    public static void isEmpty(String target, String message) {
        if (target == null) throw new BusinessException(message);
    }

    public static void isBlank(String target, String message) {
        if (target == null) throw new BusinessException(message);
        if (target.trim().isEmpty()) throw new BusinessException(message);
    }

    public static void isEmpty(Object target, String message) {
        if (target == null) throw new BusinessException(message);
    }

    public static void isTrue(boolean flag, String message) {
        if (flag) throw new BusinessException(message);
    }

    public static void isFalse(boolean flag, String message) {
        isTrue(!flag, message);
    }

}
